<!--
 /**
 * Author: hongChengHao
 * Date: 2022-07-28 11:52
 * Desc: 消息 组件
 */
-->
<template>
  <view class="msg">
    <view class="msg__laba"></view>
    <view class="msg__content mr20 ml20">
      <view class="b">{{ obj.messageType || '--' }}</view>
      <view class="fs20 fc8">{{ obj.createTime || '--' }}</view>
      <view class="mt20 tj">{{ obj.content || '--' }}</view>
    </view>
    <view>
      <u-icon name="close" @click="onDel"></u-icon>
    </view>
  </view>
</template>
<script>
  export default {
    name: 'msg',
    props: {
      obj: {
        type: Object,
        default: () => {
          return {}
        }
      }
    },
    data() {
      return {}
    },
    methods: {
      onDel() {
        this.$msg.showModal('是否确定删除该条信息?').then(() => {
          uni.$api.message
            .delSystemMsg({ messageId: this.obj.messageId })
            .then(() => {
              this.$emit('after-save')
              this.$msg.toast('删除成功!')
            })
            .catch((err) => {
              console.log(err, '我的消息')
            })
        })
      }
    }
  }
</script>
<style lang="scss" scoped>
  .msg {
    display: flex;
    background: $pageBgColor;
    padding: 20upx;
    border-bottom: 1upx solid #eee;
    &__content {
      flex: 1;
    }
    &__laba {
      width: 60upx;
      height: 60upx;
      background: url(https://public-oss-file.zmaxfilm.com/applet/img/my/laba%402x.png)
        no-repeat;
      background-size: 100%;
    }
  }
</style>
